import instance from './index';
import request from "../utils/request.js";

export function getVerifyCode() {
    return instance.get('/auth/verify-code')
    .then(response => {
        const { captchaKey, image } = response.data;
        const url = `data:image/jpeg;base64,${image}`;
        return { url, captchaKey }; // 返回包含图片URL和唯一标识符的对象
    });
}
  
  // export function login(credentials) {
  //   return instance.post('/auth/login', credentials);
  // }

  export const login = (credentials)=>{
    return request.post('/auth/login',credentials)
  }

  export const logout = () => {
    return request.post('/auth/logout');
};
  
  // export function logout() {
  //   return instance.post('/auth/logout');
  // }